package com.ltzuche.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	
	private SimpleDateFormat format;
	
	public DateUtil(String pattern) {
		format = new SimpleDateFormat(pattern);
	}
	
	public Date parse(String text) {
		try {
			return format.parse(text);
		} catch (ParseException e) {
			e.printStackTrace();
			return null;
		}
	}
	
	public String format(Date date) {
		return format.format(date);
	}

}
